S = input("Введите скобки: ")
obr = "()[]{}<>"
s0 = []
s1 = []
s2 = []
x1 = []
x2 = []
v1 = []
v2 = []
f1 = []
f2 = []

for i in S:
    if i not in obr:
        print('False')
        break

    if i == '(':
        s1.append(i)
    if i == ')':
        s2.append(i)
    if i == '[':
        x1.append(i)
    if i == ']':
        x2.append(i)
    if i == '<':
        v1.append(i)
    if i == '>':
        v2.append(i)
   
    if i == '{':
        f1.append(i)
    if i == '}':
        f2.append(i)
    if len(x1) == len(x2) and len(s1) == len(s2) and len(v1) == len(v2) and len(f1) == len(f2):
        print('True')
    else:
        print('False')
